import java.util.Scanner;

public class MT1153真因子 {
    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        // code here
        int n = input.nextInt();
        int ans = 0;
        for (int i = 1; i < n; i++) {
            if (n % i == 0) {
                ans += i;
            }
        }
        System.out.println(ans);
        input.close();
    }
}
